package com.ghpt.controller;
import com.ghpt.pojo.V2G;
import com.ghpt.service.V2GService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

@RestController
@RequestMapping("/v2g")
public class V2GController {
    private final V2GService v2GService;

    public V2GController(V2GService v2GService) {
        this.v2GService = v2GService;
    }
    @GetMapping("/{id}")
    public V2G getV2GById(@PathVariable Long id) {
        System.out.println("结果是"+v2GService.findV2GById(id));
        return v2GService.findV2GById(id);
    }
    @PutMapping
    public int updateV2G(@RequestBody V2G v2G) {
        return v2GService.updateById(v2G);
    }
}
